package SmartHome.handlers;

import SmartHome.devices.Curtain;

public class CurtainHandler extends Handler{
    private Handler nextHandler;
    private final Curtain curtain = new Curtain();

    @Override
    public void setNextHandler(Handler nextHandler) {
        this.nextHandler = nextHandler;
    }

    @Override
    public void handleRequest(String request) {
        if (request.equals("窗帘")) {
            System.out.println("CurtainHandler: 处理窗帘指令-->" + request);
            curtain.turnOn();
        } else{
            if (nextHandler != null) {
                nextHandler.handleRequest(request);
            } else {
                System.out.println("ACHandler: 无法处理该请求-->" + request);
            }
        }
    }
}
